package com.sz.youban.dt.service.terminal;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sz.youban.dt.entity.terminal.DtMsgRecords;
import com.sz.youban.dt.interfs.terminal.IDtMsgRecordsService;
import com.sz.youban.dt.service.terminal.mapper.DtMsgRecordsMapper;

/**
 * <p>
 * 短信记录信息 服务实现类
 * </p>
 *
 * @author liyang
 * @since 2017-06-05
 */
@Service
public class DtMsgRecordsServiceImpl extends ServiceImpl<DtMsgRecordsMapper, DtMsgRecords> implements IDtMsgRecordsService {

	@Autowired
	private DtMsgRecordsMapper msgRecordsMapper;
	
	@Override
	public int saveCallRecords(DtMsgRecords dtMsgRecotrs) {
		int result = msgRecordsMapper.insert(dtMsgRecotrs);
		return result;
	}

	@Override
	public Map<String, String> selectRecordTime(String appPhone) {
//		List<DtMsgRecords> list = msgRecordsMapper.selectByAppPhone(appPhone);
		DtMsgRecords msgRecords = msgRecordsMapper.selectByAppPhone(appPhone);


		Map<String,String> map = new HashMap<String,String>();
		if (msgRecords != null){
			Date lastTime = msgRecords.getTransferTime();
			map.put("exist","1");
			map.put("lastTime",lastTime.getTime()+"");
		}else{
			map.put("exist","0");
			map.put("lastTime","");
		}
		return map;
	}

}
